<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<bean:message key="languages" />:<br/>

<c:set var="localeCode" value="${sessionScope['org.apache.struts.action.LOCALE']}" scope="session" />
<c:set var="availableLanguages" value="en,ru" />

<c:forEach var="lang" items="${availableLanguages}">
	<!-- c:if test="${lang == fn:substring(localeCode, 0, 2)}" for locale codes like en_EN -->
	
	<c:if test="${lang == localeCode}">
		<html:link action="/locale.do?lang=${lang}"><b>${lang}</b></html:link> 
	</c:if>
	<c:if test="${!(lang == localeCode)}">
		<html:link action="/locale.do?lang=${lang}">${lang}</html:link>
	</c:if>
</c:forEach>